/*
 * @Autor Wei
 * @Date 2020-04-16 14:31:09
 * @LastEditors Wei
 * @LastEditTime 2020-06-08 00:11:48
 */
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import {
  finsh_task
} from "./api/finsh_task";

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";

import "./assets/iconFont/index.css";

import "@/permission";

Vue.use(ElementUI);
Vue.config.productionTip = false;

Vue.prototype.$finish_taskdata = async function (taskIndex, userId) {
  var reqdata = {
    TaskIndex: taskIndex,
    userid: userId
  };
  var resdata = await finsh_task(reqdata);
  console.log(resdata);
  if (resdata.code == 200) {
    if (taskIndex !== 13) {
      this.$notify({
        title: "任务成功",
        message: resdata.text,
        type: "success"
      });
    }

  } else {
    if (taskIndex == 0) {
      this.$notify({
        title: "提醒",
        message: resdata.text,
        type: "warning"
      });
    }
  }
};
// router.beforeEach((to, from, next) => {
//   /* 路由发生变化修改页面title */
//   if (to.meta.title) {
//     document.title = to.meta.title;
//   }
//   next();
// });

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
